﻿using System;
using System.Web.Mvc;

namespace Qask.Web
{
    public class QuestionExists : ActionFilterAttribute
    {
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (filterContext.ActionParameters["id"] == null)
            {
                Elmah.ErrorSignal.FromCurrentContext().Raise(new ArgumentException("Id cannot be null or empty", "filterContext"));
                filterContext.Result = new HttpNotFoundResult();
            }
            base.OnActionExecuting(filterContext);
        }
    }
}